package com.rainng.coursesystem.controller;

import com.rainng.coursesystem.model.vo.response.ResultVO;

//这些方法可以被子类的控制器继承和使用，从而简化控制器中的代码编写，提高代码的复用性和可读性。

public class BaseController {
    protected ResultVO result(Object data) {
        return new ResultVO(ResultVO.SUCCESS, "success", data);
    }

    protected ResultVO result(Object data, String message) {
        return new ResultVO(ResultVO.SUCCESS, message, data);
    }

    protected ResultVO failedResult(String message) {
        return new ResultVO(ResultVO.FAIL, message, null);
    }

    protected ResultVO failedResult(String message, Object data) {
        return new ResultVO(ResultVO.FAIL, message, data);
    }

    protected boolean isNullOrEmpty(String str) {
        return "".equals(str);
    }
}
